﻿using System;
using System.Globalization;

namespace MessagePack.Formatters
{
	// Token: 0x02000058 RID: 88
	public class DecimalFormatter : IMessagePackFormatter<decimal>
	{
		// Token: 0x0600014F RID: 335 RVA: 0x0000581B File Offset: 0x00003C1B
		private DecimalFormatter()
		{
		}

		// Token: 0x06000150 RID: 336 RVA: 0x00005823 File Offset: 0x00003C23
		public int Serialize(ref byte[] bytes, int offset, decimal value, IFormatterResolver formatterResolver)
		{
			return MessagePackBinary.WriteString(ref bytes, offset, value.ToString(CultureInfo.InvariantCulture));
		}

		// Token: 0x06000151 RID: 337 RVA: 0x00005838 File Offset: 0x00003C38
		public decimal Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
		{
			return decimal.Parse(MessagePackBinary.ReadString(bytes, offset, out readSize), CultureInfo.InvariantCulture);
		}

		// Token: 0x0400004D RID: 77
		public static readonly DecimalFormatter Instance = new DecimalFormatter();
	}
}
